package com.chatmcp.mcprouter.cli;

import org.springframework.boot.ApplicationArguments;
import org.springframework.context.ApplicationContext;

/**
 * 版本命令
 * 显示MCP Router的版本信息
 */
public class VersionCommand implements Command {

    @Override
    public void execute(ApplicationContext context, String[] args, ApplicationArguments applicationArgs) {
        String version = context.getEnvironment().getProperty("app.version", "0.0.1");
        String buildDate = context.getEnvironment().getProperty("app.build-date", "未知");
        String javaVersion = System.getProperty("java.version");
        
        System.out.println("MCP Router 版本: " + version);
        System.out.println("构建日期: " + buildDate);
        System.out.println("Java版本: " + javaVersion);
        System.out.println("操作系统: " + System.getProperty("os.name") + " " + System.getProperty("os.version"));
        
        // 终止应用，避免启动Spring容器
        System.exit(0);
    }

    @Override
    public String getDescription() {
        return "显示版本信息";
    }

    @Override
    public String getUsage() {
        return "version";
    }
} 